package com.zjj.dao;

import com.zjj.pojo.Users;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

    @Select("SELECT * FROM tb_user WHERE id = #{id}")
    @Results({@Result(id = true,property = "id", column = "id"),
            @Result(property = "username", column = "username"),
            @Result(property = "address", column = "address"),
            @Result(property = "ordersList", column = "id",
                    many = @Many(select = "com.zjj.dao.OrdersMapper.selectOrdersByUserId"))})
    Users selectUserById(int id);

}
